#include<iostream>
#include<fstream>
#include<iomanip>
#include<cmath>
#include<string>
#include<cstring>
#include<set>
#include<map>
#include<vector>
#include<queue>
#include<stack>
#include<cstdio>
#include<cstdlib>
#include<algorithm>
using namespace std;
int n,m,a[10010];
int main(){
	freopen("sort.in","r",stdin);
	freopen("sort.out","w",stdout);
	scanf("%d%d",&n,&m);
	for(int i=1;i<=n;i++){
		scanf("%d",&a[i]);
	}
	for(int i=1;i<=m;i++){
		int op;
		scanf("%d",&op);
		if(op==1){
			int c,d;
			scanf("%d%d",&c,&d);
			n=max(n,c);
			a[c]=d;
		}
		if(op==2){
			int c;
			scanf("%d",&c);
			int d=a[c],ss=1;
			for(int j=1;j<=n;j++){
				if(a[j]<d){
					ss++;
				}
				if(a[j]==d&&c>j){
					ss++;
				}
			}
			printf("%d\n",ss);
		}
	}
	return 0;
}
